<extend name="Index:base" />
<block name="body">
<div class="hd-menu-list">
  <ul>
      <li class="active"><a href="#">管理员</a></li>
      <li><a href="{:U('userAdd')}">添加管理员</a></li>
  </ul>
</div>
<table class="hd-table hd-table-list">
	<thead>
		<tr>
		   <td class="hd-w50">uid</td>
		   <td>用户名</td>
		   <td>所属角色</td>
		   <td>登录IP</td>
		   <td>登录时间</td>
		   <td>邮箱</td>
		   <td>状态</td>
		   <td class="hd-w120">操作</td>
		</tr>
	</thead>
	<tbody>
		<foreach name="data" item="v">
			<tr>
				<td>{$v.uid}</td>
				<td>{$v.name}</td>
				<td>
					<if condition="in_array($v['uid'],C('ADMIN_ID'))">
						超级管理员
					<else />
					<foreach name="v.auth_group" item="v2">
						{$v2.title}&nbsp;&nbsp;&nbsp;&nbsp;
					</foreach>
					</if>
				</td>
				<td>{$v.loginip}</td>
				<td>{$v.logintime|date='Y-m-d H:i:s',###}</td>
				<td>{$v.mail}</td>
				<td>
					<if condition="$v['islock'] eq 1">
							X <else /> √
					</if>
				</td>
				<td>
					<if condition="in_array($v['uid'],C('ADMIN_ID'))">
						<if condition="in_array(session('user_auth.uid'),C('ADMIN_ID'))">
								<a href="{:U('userEdit',array('uid'=>$v['uid']))}">修改</a><else />修改
						</if>
						<else />
					<a href="{:U('userEdit',array('uid'=>$v['uid']))}">修改</a>	
					</if>
					<span class="line">|</span>
					<if condition="in_array($v['uid'],C('ADMIN_ID'))">
					删除
					<else />
					<a href="javascript:;" onclick="delUser({$v['uid']})">删除</a>
					</if>
					<span class="line">|</span>
					<if condition="in_array($v['uid'],C('ADMIN_ID'))">
					禁用
					<else/>
					<if condition="$v['islock'] eq 1">
						<a href="javascript:hd_ajax('{:U('userOn')}',{id:{$v['uid']}},'__ACTION__')">解禁</a>
							<else /><a href="javascript:hd_ajax('{:U('userOff')}',{id:{$v['uid']}},'__ACTION__')">禁用</a>
					</if>
					</if>
				</td>
			</tr>
		</foreach>
	</tbody>
	<script type="text/javascript">
    function delUser (id) {
        hd_modal({
            width: 400,//宽度
            height: 150,//高度
            title: '提示',//标题
            content: '确定删除吗',//提示信息
            button: true,//显示按钮
            button_success: "确定",//确定按钮文字
            button_cancel: "关闭",//关闭按钮文字
            timeout: 0,//自动关闭时间 0：不自动关闭
            shade: true,//背景遮罩
            shadeOpacity: 0.1,//背景透明度
            success: function () {
                hd_ajax('{:U("userDel")}', {id: id}, '{:U("index")}');
            }
        });
    }
</script>
</block>